<!DOCTYPE HTML>
<html>
<head>
<title>注册</title>
<!-- Custom Theme files -->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all"/>
<!-- Custom Theme files -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta name="keywords" content="Login form web template, Sign up Web Templates, Flat Web Templates, Login signup Responsive web template, Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<!--Google Fonts-->

<!--Google Fonts-->
<script src="js/jquery.js"></script>

</head>
<body style="background-image: url(images/back3.jpeg);background-repeat: no-repeat;background-size: 1550px 757px;">
<div class="login">
	<h2>欢迎来到广西科技大学图书馆</h2>
	<div class="login-top">
		<h1>注册</h1>
	
			<input type="text" id = "account"  placeholder="请输入账号" >
			<input type="text" id = "username"  placeholder="请输入姓名" >
			<input type="password"  id = "password"placeholder="请输入密码" >
			<input type="text"  id = "email"placeholder="请输入邮箱" >
			<input type="text"  id = "telephone"placeholder="请输入电话号码" >   
	    <div class="forgot">            	    	
	    	<input type="button"  id="register" value="注册" ></input></br></br>                   
	    </div>
      
	</div>
	<div class="login-bottom">
		
	</div>
</div>	
<div class="copyright">
	
</div>

<script >

   $("#register").click(function(){
       var account=$("#account").val();
       var username = $("#username").val();
        var password=$("#password").val();
        var email = $("#email").val();
        var telephone = $("#telephone").val();

       var json={"account":account,"username":username,"password":password,"email":email,"telephone":telephone};
       console.log(json);
       $.ajax({
           type:'post',
           url:"http://127.0.0.1:8080/register",
           contentType:"application/x-www-form-urlencoded",
            data:json,
            dataType:'json',
           success:function(data){
               console.log(data);
               if(data.massage==1){
                   alert("注册成功");
                   window.location.href='http://127.0.0.1:8848/t/moban3932/User_book.html?account='+account;
               }
               else if(data.massage == 0){
                   alert("注册失败,请重新操作");
                   window.location.href='注册.html';
               }
    
           },
            error:function(){
                   alert("注册失败,请重新操作!!!!");
                  window.location.href='注册.html';
               }
       })
      
   })
      
           
    </script>
</body>
</html>